在最小化安装的CentOS 7下部署 Seafile 服务器(使用 MariaDB)

测试平台:VM10虚拟机 ,CentOS 7 64位,最小化安装。

一、最小化安装的CentOS部署Seafile前的准备工作

1、安装虚机前将网络类型设置为桥接方式。

2、安装时手工配置网卡IP、子网掩码、网关、DNS,并且打开网络开关。如果忘记打开,reboot后网卡处于未激活状态,无法SSH登录,root 用户本机登陆,使用 nmtui 命令,激活网卡。编辑网卡配置文件,实现开机激活网卡。

#选择第二项激活网卡

[root@localhost ~]# nmtui

#最后的数字是激活的网卡号,修改配置文件参数  “ONBOOT=yes”

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno1677736

3、安装完成后添加国内yum软件源,我采用的是163的源。

#备份yum源配置文件

[root@localhost ~]# cp /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo_backup

#编辑源配置文件

[root@localhost ~]#vi /etc/yum.repos.d/CentOS-Base.repo

#复制下面的文本,替换掉源文件内容:

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client. You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-$releasever - Base - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever - Updates - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - 163.com

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - 163.com

baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#运行以下命令生成缓存

[root@localhost ~]# yum clean all

[root@localhost ~]# yum makecache

4、安装wget下载程序

[root@localhost ~]# yum install wget

二、下载seafil社区版软件包

[root@localhost ~]# wget http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.1.1_x86-64.tar.gz

三、按部署手册指引建立目录、解压文件

[root@localhost ~]# cd /

#在根目录下创建目录 haiwen

[root@localhost /]# mkdir haiwen

#把下载的服务端软件包移到 haiwen目录下

[root@localhost /]# mv /root/seafile-server_6.1.1_x86-64.tar.gz /haiwen/

[root@localhost /]# cd /haiwen

#解压软件包

[root@localhost haiwen]# tar -xzf seafile-server_6.1.1_x86-64.tar.gz

[root@localhost haiwen]# mkdir installed

[root@localhost haiwen]# mv seafile-server_6.1.1_x86-64.tar.gz installed/

四、安装MariaDB、python2.7

[root@localhost haiwen]# yum install mariadb-server

[root@localhost haiwen]# yum install python-setuptools python-imaging python-ldap MySQL-python python-memcached python-urllib3

五、启动MariaDB服务并设置开机启动,配置MariaDB初始根密码

[root@localhost haiwen]# systemctl start mariadb.service

[root@localhost haiwen]# systemctl enable mariadb.service

[root@localhost haiwen]# mysql_ secure_installation

Enter current password for root (enter for none):  #初次运行直接回车

Set root password? [Y/n]  #是否设置root用户密码,输入y并回车或直接回车

New password:  #设置root用户的密码

Re-enter new password:  #再输入一次你设置的密码

Remove anonymous users? [Y/n]  #是否删除匿名用户,生产环境建议删除,所以直接回车

Disallow root login remotely? [Y/n]  #是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止

Remove test database and access to it? [Y/n]  #是否删除test数据库,直接回车

Reload privilege tables now? [Y/n]  #是否重新加载权限表,直接回车

六、安装Seafile

[root@localhost haiwen]# cd /haiwen/seafile-server-6.1.1/

[root@localhost seafile-server-6.1.1]# ./setup-seafile-mysql.sh

该脚本会依次询问你一些问题,从而一步步引导你配置 Seafile 的各项参数:

What is the name of the server? It will be displayed on the client.

3 - 15 letters or digits

[ server name ]  seatest

#服务器的名字,目前该配置已经不再使用,这里填seatest

What is the ip or domain of the server?

For example: www.mycompany.com, 192.168.1.101

[ This server's ip or domain ] 10.0.0.6

 #服务器的 IP 地址或者域名,客户端通过这个 IP 或者地址来访问你的 Seafile 服务,这里填10.0.0.6

Where do you want to put your seafile data?

Please use a volume with enough free space

[ default "/haiwen/seafile-data" ]  

#数据存放的目录,默认是 /data/haiwen/seafile-data,这里直接回车

Which port do you want to use for the seafile fileserver?

[ default "8082" ]  

#seafile fileserver 使用的 TCP 端口,该端口用于文件同步,请使用默认的 8082,不能更改

Please choose a way to initialize seafile databases:

[1] Create new ccnet/seafile/seahub databases

[2] Use existing ccnet/seafile/seahub databases

[ 1 or 2 ] 1  

#要求选择一种创建 Seafile 数据库的方式。选1,需要提供MariaDB初始根密码,程序会创建数据库和用户。选2,系统采用已创建的数据库。这里选1

What is the host of mysql server?

[ default "localhost" ]  

#数据库主机名称,默认即可,直接回车

What is the port of mysql server?

[ default "3306" ]  

#数据库端口,默认即可,直接回车

what is the password of the mysql root user?

[ root password ]  

#数据库根密码,填写MariaDB初始根密码

verifying password of user root ...  done

Enter the name for mysql user of seafile. It would be created if not exists.

[ default "seafile" ]  

#数据库用户名,默认即可,直接回车

Enter the password for mysql user "seafile":

[ password for seafile ]  

#数据库对应用户名的密码,可填写MariaDB初始根密码

Enter the database name for ccnet-server:

[ default "ccnet-db" ]  

#ccnet-server数据库名称,默认即可,直接回车

Enter the database name for seafile-server:

[ default "seafile-db" ]  

#seafile-server数据库名称,默认即可,直接回车

Enter the database name for seahub:

[ default "seahub-db" ]  

#seahub数据库名称,默认即可,直接回车

--------------------------------

**This is your configuration**

server name:seatest

server ip/domain:   10.0.0.6

seafile data dir:   /haiwen/seafile-data

fileserver port:8082

database:   create new

ccnet database: ccnet-db

seafile database:   seafile-db

seahub database:seahub-db

database user:  seafile

---------------------------------

Press ENTER to continue, or Ctrl-C to abort

Generating ccnet configuration ...

done

Successly create configuration dir /haiwen/ccnet.

Generating seafile configuration ...

Done.

done

Generating seahub configuration ...

Now creating seahub database tables ...

creating seafile-server-latest symbolic link ...  done

Your seafile server configuration has been finished successfully.

run seafile server: ./seafile.sh { start | stop | restart }

run seahub  server: ./seahub.sh  { start | stop | restart }

If you are behind a firewall, remember to allow input/output of these tcp ports:

port of seafile fileserver:   8082

port of seahub:   8000

When problems occur, Refer to

https://github.com/haiwen/seafile/wiki

for information. 

 #到这里安装基本完成,进一步配置防火墙,启动Seafile相关服务即可使用

七、配置防火墙,打开需要用的端口

[root@localhost seafile-server-6.1.1]#  firewall-cmd --zone=public --add-port=8000/tcp --permanent

[root@localhost seafile-server-6.1.1]#  firewall-cmd --zone=public --add-port=8082/tcp --permanent

[root@localhost seafile-server-6.1.1]#  firewall-cmd --reload

八、启动Seafile、Seahub服务

[root@localhost seafile-server-6.1.1]#  ./seafile.sh start

[root@localhost seafile-server-6.1.1]#  ./seahub.sh start

在执行seahub.sh脚本执行过程中,设置seafile管理员帐号(邮箱注册)、密码。

脚本执行完成后,可以在浏览器地址栏中输入服务器地址(带端口号,本例为10.0.0.6:8000),测试基本功能。

九、设置Seafile开机启动

这里采用seafile论坛neroxps的方法,官方手册上的第一种方法没成功。

#建立seafile服务

[root@localhost seafile-server-6.1.1]# vi /etc/systemd/system/seafile.service

输入以下内容,注意修改“/haiwen”为你的seafile安装目录:

[Unit]

Description=Seafile

# add mysql.service or postgresql.service depending on your database to the line below

# 如果没有使用memcached则去掉memcached.service

After=network.target mariadb.service

[Service]

Type=oneshot

ExecStart=/haiwen/seafile-server-latest/seafile.sh start

# 如果seahub使用了nginx反代,请修改为 ExecStart=${seafile_dir}/seafile-server-latest/seahub.sh start-fastcgi

ExecStart=/haiwen/seafile-server-latest/seahub.sh start

ExecStop=/haiwen/seafile-server-latest/seafile.sh stop

ExecStop=/haiwen/seafile-server-latest/seahub.sh stop

RemainAfterExit=yes

# User 和 Group 如果未建立seafile用户和用户组,则修改为root,否则无法启动.

User=root

Group=root

[Install]

WantedBy=multi-user.target

#运行systemctl daemon-reload使配置生效

[root@localhost seafile-server-6.1.1]# systemctl daemon-reload

按需要执行命令:

#启动seafile

[root@localhost seafile-server-6.1.1]# systemctl start seafile

#停止seafile

[root@localhost seafile-server-6.1.1]# systemctl stop seafile

#设置seafile随系统启动

[root@localhost seafile-server-6.1.1]# systemctl enable seafile

#检查seafile是否已经设置为自启动

[root@localhost seafile-server-6.1.1]# systemctl is-enabled seafile

#关闭seafile随系统启动

[root@localhost seafile-server-6.1.1]# systemctl disable seafile

OK,完成。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 160,026评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,655评论 1 296
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,726评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,204评论 0 213
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,558评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,731评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,944评论 2 314
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,698评论 0 203
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,438评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,633评论 2 247
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,125评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,444评论 3 255
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,137评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,103评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,888评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,772评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,669评论 2 271

推荐阅读更多精彩内容